package com.jt.dify.model;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.activerecord.Model;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * 大模型对话记录表 实体类。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@Accessors(chain = true)
@Data
@Table(value = "chat_record")
public class ChatRecord extends Model<ChatRecord> implements Serializable {

    private static final long serialVersionUID = 2771953165829902414L;

    /**
     * 主键
     */
    @Id
    @Column(value = "id")
    private Long id;

    /**
     * 会话ID
     */
    @Column(value = "conversation_id")
    private String conversationId;

    /**
     * 第一个ask
     */
    @Column(value = "content")
    private String content;

    /**
     * 创建时间
     */
    @Column(value = "create_time", onInsertValue = "now()")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(value = "update_time", onInsertValue = "now()", onUpdateValue = "now()")
    private Date updateTime;

    @Column(value = "type", isLogicDelete = true)
    private Integer type;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ChatRecord that = (ChatRecord) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }
}
